﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EstoqueUnifeiADO.Controles
{
    public partial class ctrlPesquisarProdutos : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ObjectDataSource2_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            List<KeyValuePair<string, object>> pesquisa = new List<KeyValuePair<string, object>>();
            if (!string.IsNullOrEmpty(tbTitulo.Text))
                pesquisa.Add( new KeyValuePair<string, object>("Titulo", tbTitulo.Text));
            if (!string.IsNullOrEmpty(tbDescricao.Text))
                pesquisa.Add(new KeyValuePair<string, object>("Descricao", tbDescricao.Text));
            if (!string.IsNullOrEmpty(ddlMarca.SelectedValue))
                pesquisa.Add(new KeyValuePair<string, object>("Marca", ddlMarca.SelectedValue));
            e.InputParameters["pesquisa"]=pesquisa;
            
        }

        protected void Pesquisar(object sender, EventArgs e)
        {
            GridView1.DataBind();
        }
    }
}